package com.gitee.mrj.aiboot.core.sf.generators.ui.widget.extend;

import com.fasterxml.jackson.databind.node.ObjectNode;
import com.gitee.mrj.aiboot.annotation.config.sf.ui.widget.extend.ObjectTabsetWidget;
import com.gitee.mrj.aiboot.core.sf.generators.FormDefinitionGenerator;
import com.gitee.mrj.aiboot.core.sf.generators.UIForm;
import org.springframework.core.annotation.AnnotatedElementUtils;
import org.springframework.stereotype.Component;

@Component
public class ObjectTabsetWidgetGenerator implements FormDefinitionGenerator {
   @Override
    public void generate(UIForm node, Class clazz) {
        ObjectTabsetWidget arrayWidget = AnnotatedElementUtils.findMergedAnnotation(clazz, ObjectTabsetWidget.class);
        generate(node, arrayWidget);
    }

    private void generate(UIForm node, ObjectTabsetWidget arrayWidget) {
        ObjectNode ui = node.getUi();
        ui.put("widget", "objectTabset");
    }


    @Override
    public Class[] supports() {
        return new Class[]{ObjectTabsetWidget.class};
    }
}
